﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wix.Aura.Common.CustomTypes;
using System.Xml.Serialization;

namespace Wix.Aura.Common {
	public class Component : IXmlSerializable {
		public Component() {
			AppId = new List<AppId>();
			Category = new List<Category>();
			Class = new List<Class>();
			Condition = new List<ComponentCondition>();
			CopyFile = new List<CopyFile>();
			CreateFolder = new List<CreateFolder>();
		}

		public int? ComPlusFlags { get; set; }
		public string Directory { get; set; }
		public YesNoType DisableRegistryReflection { get; set; }
		public DiskIdType? DiskIdType { get; set; }
		public string Feature { get; set; }
		public ComponentGuid? Guid { get; set; }
		public string Id { get; set; }
		public YesNoType KeyPath { get; set; }
		public Location Location { get; set; }
		public YesNoType MultiInstance { get; set; }
		public YesNoType NeverOverride { get; set; }
		public YesNoType Permanent { get; set; }
		public YesNoType Shared { get; set; }
		public YesNoType SharedDllRefCount { get; set; }
		public YesNoType Transitive { get; set; }
		public YesNoType UninstallWhenSuperseded { get; set; }
		public YesNoType Win64 { get; set; }

		public ICollection<AppId> AppId { get; private set; }
		public ICollection<Category> Category { get; private set; }
		public ICollection<Class> Class { get; private set; }
		public ICollection<ComponentCondition> Condition { get; private set; }
		public ICollection<CopyFile> CopyFile { get; private set; }
		public ICollection<CreateFolder> CreateFolder { get; private set; }
		//public ICollection<Environment> Environment { get; private set; }
		//public ICollection<Extension> Extension { get; private set; }
		//public ICollection<File> File { get; private set; }
		//public ICollection<IniFile> IniFile { get; private set; }
		//public ICollection<Interface> Interface { get; private set; }
		//public ICollection<IsolateComponent> IsolateComponent { get; private set; }
		//public ICollection<ODBCDataSource> ODBCDataSource { get; private set; }
		//public ICollection<ODBCDriver> ODBCDriver { get; private set; }
		//public ICollection<ODBCTranslator> ODBCTranslator { get; private set; }
		//public ICollection<ProgId> ProgId { get; private set; }
		//public ICollection<Registry> Registry { get; private set; }
		//public ICollection<RegistryKey> RegistryKey { get; private set; }
		//public ICollection<RegistryValue> RegistryValue { get; private set; }
		//public ICollection<RemoveFile> RemoveFile { get; private set; }
		//public ICollection<RemoveFolder> RemoveFolder { get; private set; }
		//public ICollection<RemoveRegistryKey> RemoveRegistryKey { get; private set; }
		//public ICollection<RemoveRegistryValue> RemoveRegistryValue { get; private set; }
		//public ICollection<ReserveCost> ReserveCost { get; private set; }
		//public ICollection<ServiceConfig> ServiceConfig { get; private set; }
		//public ICollection<ServiceConfigFailureActions> ServiceConfigFailureActions { get; private set; }
		//public ICollection<ServiceControl> ServiceControl { get; private set; }
		//public ICollection<ServiceInstall> ServiceInstall { get; private set; }
		//public ICollection<Shortcut> Shortcut { get; private set; }
		//public ICollection<SymbolPath> SymbolPath { get; private set; }
		//public ICollection<TypeLib> TypeLib { get; private set; }

		public System.Xml.Schema.XmlSchema GetSchema() {
			throw new NotImplementedException();
		}

		public void ReadXml(System.Xml.XmlReader reader) {
			throw new NotImplementedException();
		}

		public void WriteXml(System.Xml.XmlWriter writer) {
			writer.WriteStartElement("Component");
			writer.WriteAttribute("ComPlusFlags", ComPlusFlags);
			writer.WriteAttribute("Directory", Directory);
			writer.WriteAttribute("DisableRegistryReflection", DisableRegistryReflection);
			writer.WriteAttribute("DiskIdType", DiskIdType);
			writer.WriteAttribute("Feature", Feature);
			writer.WriteAttribute("Guid", Guid);
			writer.WriteAttribute("Id", Id);
			writer.WriteAttribute("KeyPath", KeyPath);
			writer.WriteAttribute("Location", Location);
			writer.WriteAttribute("MultiInstance", MultiInstance);
			writer.WriteAttribute("NeverOverride", NeverOverride);
			writer.WriteAttribute("Permanent", Permanent);
			writer.WriteAttribute("Shared", Shared);
			writer.WriteAttribute("SharedDllRefCount", SharedDllRefCount);
			writer.WriteAttribute("Transitive", Transitive);
			writer.WriteAttribute("UninstallWhenSuperseded", UninstallWhenSuperseded);
			writer.WriteAttribute("Win64", Win64);
			writer.WriteElements(AppId);
			writer.WriteElements(Category);
			writer.WriteElements(Class);
			writer.WriteElements(Condition);
			writer.WriteElements(CopyFile);
			writer.WriteElements(CreateFolder);
			writer.WriteEndElement();
		}
	}
}
